///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 12 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////

#include "MainFrameBase.h"

///////////////////////////////////////////////////////////////////////////

MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxHORIZONTAL );
	
	wxStaticBoxSizer* sbSizer2;
	sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
	
	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer( wxVERTICAL );
	
	wxBoxSizer* bSizer5;
	bSizer5 = new wxBoxSizer( wxHORIZONTAL );
	
	m_staticText2 = new wxStaticText( this, wxID_ANY, wxT("串   口"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText2->Wrap( -1 );
	bSizer5->Add( m_staticText2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_textCtrl_port = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );
	bSizer5->Add( m_textCtrl_port, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
	
	m_btn_showPort = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,20 ), wxBU_AUTODRAW|wxSIMPLE_BORDER );
	bSizer5->Add( m_btn_showPort, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 5 );
	
	bSizer2->Add( bSizer5, 0, wxEXPAND, 0 );
	
	wxBoxSizer* bSizer6;
	bSizer6 = new wxBoxSizer( wxHORIZONTAL );
	
	m_staticText4 = new wxStaticText( this, wxID_ANY, wxT("波特率"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText4->Wrap( -1 );
	bSizer6->Add( m_staticText4, 0, wxALL, 5 );
	
	wxArrayString m_choice_buadRateChoices;
	m_choice_buadRate = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice_buadRateChoices, 0 );
	m_choice_buadRate->SetSelection( 0 );
	bSizer6->Add( m_choice_buadRate, 0, wxALL, 5 );
	
	bSizer2->Add( bSizer6, 0, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer10;
	bSizer10 = new wxBoxSizer( wxHORIZONTAL );
	
	m_staticText5 = new wxStaticText( this, wxID_ANY, wxT("数据位"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText5->Wrap( -1 );
	bSizer10->Add( m_staticText5, 0, wxALL, 5 );
	
	wxString m_choice_dataBitsChoices[] = { wxT("8"), wxT("7") };
	int m_choice_dataBitsNChoices = sizeof( m_choice_dataBitsChoices ) / sizeof( wxString );
	m_choice_dataBits = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice_dataBitsNChoices, m_choice_dataBitsChoices, 0 );
	m_choice_dataBits->SetSelection( 0 );
	bSizer10->Add( m_choice_dataBits, 0, wxALL, 5 );
	
	bSizer2->Add( bSizer10, 0, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer9;
	bSizer9 = new wxBoxSizer( wxHORIZONTAL );
	
	m_staticText41 = new wxStaticText( this, wxID_ANY, wxT("停止位"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText41->Wrap( -1 );
	bSizer9->Add( m_staticText41, 0, wxALL, 5 );
	
	wxString m_choice_stopBitsChoices[] = { wxT("1"), wxT("2") };
	int m_choice_stopBitsNChoices = sizeof( m_choice_stopBitsChoices ) / sizeof( wxString );
	m_choice_stopBits = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice_stopBitsNChoices, m_choice_stopBitsChoices, 0 );
	m_choice_stopBits->SetSelection( 0 );
	bSizer9->Add( m_choice_stopBits, 0, wxALL, 5 );
	
	bSizer2->Add( bSizer9, 0, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer7;
	bSizer7 = new wxBoxSizer( wxHORIZONTAL );
	
	m_staticText3 = new wxStaticText( this, wxID_ANY, wxT("核验位"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText3->Wrap( -1 );
	bSizer7->Add( m_staticText3, 0, wxALL, 5 );
	
	wxString m_choice_parityChoices[] = { wxT("None"), wxT("Odd"), wxT("Even"), wxT("Space") };
	int m_choice_parityNChoices = sizeof( m_choice_parityChoices ) / sizeof( wxString );
	m_choice_parity = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice_parityNChoices, m_choice_parityChoices, 0 );
	m_choice_parity->SetSelection( 0 );
	bSizer7->Add( m_choice_parity, 0, wxALL, 5 );
	
	bSizer2->Add( bSizer7, 0, wxEXPAND, 5 );
	
	m_btn_open = new wxToggleButton( this, wxID_ANY, wxT("打开"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer2->Add( m_btn_open, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	sbSizer2->Add( bSizer2, 0, wxEXPAND, 5 );
	
	m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	sbSizer2->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer3;
	bSizer3 = new wxBoxSizer( wxVERTICAL );
	
	wxBoxSizer* bSizer12;
	bSizer12 = new wxBoxSizer( wxHORIZONTAL );
	
	m_staticText6 = new wxStaticText( this, wxID_ANY, wxT("S:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText6->Wrap( -1 );
	bSizer12->Add( m_staticText6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_txt_sendCount = new wxTextCtrl( this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
	bSizer12->Add( m_txt_sendCount, 0, wxALL, 5 );
	
	bSizer3->Add( bSizer12, 0, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer14;
	bSizer14 = new wxBoxSizer( wxHORIZONTAL );
	
	m_staticText7 = new wxStaticText( this, wxID_ANY, wxT("R:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText7->Wrap( -1 );
	bSizer14->Add( m_staticText7, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_txt_RecvCount = new wxTextCtrl( this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
	bSizer14->Add( m_txt_RecvCount, 0, wxALL, 5 );
	
	bSizer3->Add( bSizer14, 0, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer15;
	bSizer15 = new wxBoxSizer( wxVERTICAL );
	
	m_button1 = new wxButton( this, wxID_ANY, wxT("重置统计"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer15->Add( m_button1, 0, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	bSizer3->Add( bSizer15, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	m_button61 = new wxButton( this, wxID_ANY, wxT("清空接收区"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer3->Add( m_button61, 0, wxALIGN_CENTER|wxALL, 5 );
	
	m_checkBox_hexshow = new wxCheckBox( this, wxID_ANY, wxT("16进制显示"), wxDefaultPosition, wxDefaultSize, 0 );
	m_checkBox_hexshow->SetValue(true); 
	bSizer3->Add( m_checkBox_hexshow, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	sbSizer2->Add( bSizer3, 0, wxEXPAND, 5 );
	
	m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	sbSizer2->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer4;
	bSizer4 = new wxBoxSizer( wxVERTICAL );
	
	m_button3 = new wxButton( this, wxID_ANY, wxT("Select File"), wxDefaultPosition, wxDefaultSize, 0 );
	m_button3->Enable( false );
	
	bSizer4->Add( m_button3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	
	m_button4 = new wxButton( this, wxID_ANY, wxT("Send File"), wxDefaultPosition, wxDefaultSize, 0 );
	m_button4->Enable( false );
	
	bSizer4->Add( m_button4, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	
	m_btn_sendData = new wxButton( this, wxID_ANY, wxT("手动发送"), wxDefaultPosition, wxDefaultSize, 0 );
	m_btn_sendData->Enable( false );
	
	bSizer4->Add( m_btn_sendData, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	
	m_button6 = new wxButton( this, wxID_ANY, wxT("清空发送区"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer4->Add( m_button6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	
	m_checkBox_hexsend = new wxCheckBox( this, wxID_ANY, wxT("16进制发送"), wxDefaultPosition, wxDefaultSize, 0 );
	m_checkBox_hexsend->SetValue(true); 
	bSizer4->Add( m_checkBox_hexsend, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	
	sbSizer2->Add( bSizer4, 1, wxEXPAND, 5 );
	
	bSizer1->Add( sbSizer2, 0, wxEXPAND, 5 );
	
	wxStaticBoxSizer* sbSizer4;
	sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
	
	wxBoxSizer* bSizer11;
	bSizer11 = new wxBoxSizer( wxVERTICAL );
	
	m_textCtrl_recv = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY );
//	m_textCtrl_recv->SetMaxLength( 8 );
	bSizer11->Add( m_textCtrl_recv, 5, wxALIGN_LEFT|wxALL|wxEXPAND, 5 );
	
	m_textCtrl_send = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
//	m_textCtrl_send->SetMaxLength( 5 );
	bSizer11->Add( m_textCtrl_send, 2, wxALL|wxEXPAND, 5 );
	
	sbSizer4->Add( bSizer11, 1, wxEXPAND, 5 );
	
	bSizer1->Add( sbSizer4, 1, wxEXPAND, 5 );
	
	this->SetSizer( bSizer1 );
	this->Layout();
	m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
	
	this->Centre( wxBOTH );
	
	// Connect Events
	m_btn_showPort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onShowPorts ), NULL, this );
	m_btn_open->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onOpenUtra ), NULL, this );
	m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onResetCount ), NULL, this );
	m_button61->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onClearRecv ), NULL, this );
	m_checkBox_hexshow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::onHexFormatChange ), NULL, this );
	m_btn_sendData->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onSendData ), NULL, this );
	m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onClearSend ), NULL, this );
	m_checkBox_hexsend->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::onHexFormatChange ), NULL, this );
}

MainFrameBase::~MainFrameBase()
{
	// Disconnect Events
	m_btn_showPort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onShowPorts ), NULL, this );
	m_btn_open->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onOpenUtra ), NULL, this );
	m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onResetCount ), NULL, this );
	m_button61->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onClearRecv ), NULL, this );
	m_checkBox_hexshow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::onHexFormatChange ), NULL, this );
	m_btn_sendData->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onSendData ), NULL, this );
	m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onClearSend ), NULL, this );
	m_checkBox_hexsend->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::onHexFormatChange ), NULL, this );
	
}
